// 护理管理 / 错衣缺衣

import r from '@/utils/request';
import type { ListParams, ListResponseType, ResponseType } from '../types';


enum API {
    list = '/clothes/list', //错衣缺衣列表
    clothesget = '/clothes/get/',//单条错衣缺衣信息
    delAll='/clothes/deleteAll',
    del = '/clothes/delete/', //删除错衣缺衣
    add = '/clothes/add', //添加错衣缺衣
    update = '/clothes/update',//修改错衣缺衣

}

export interface clotheslistParams extends ListParams {
    name: string
    elderlyName:string
    state:string
    beginDate: string
    endDate: string
    key: string

}

type ClotheslistResType = ListResponseType<{
    id:             number;
    companyId:      number;
    elderlyId:      number;
    title:          string;
    content:        string;
    type:           string;
    state:          string;
    addTime:        string;
    addAccountId:   number;
    addAccountName: string;
    begName:        any;
    elderlyName:    any;
    elderlyPhoto:   any;
    elderlyGender:  any;
    elderlyIdCard:  any;
    houseName:      any;
    buildingName:   string;
    pictures:       ClotheslistPicture[];
}>


export interface ClotheslistPicture {
    id:       number;
    clotheId: number;
    file:     string;
}
export interface Elderly {
    id: number;
    playId: number;
    elderlyId: number;
    elderlyName: string;
    elderlyPhoto: any;
    begName: string;
    houseName: string;
    buildingName: string;
}

type clothesgetResType = ResponseType<{
    id:             number;
    companyId:      number;
    elderlyId:      number;
    title:          string;
    content:        string;
    type:           string;
    state:          string;
    addTime:        string;
    addAccountId:   number;
    addAccountName: string;
    begName:        any;
    elderlyName:    any;
    elderlyPhoto:   any;
    elderlyGender:  any;
    elderlyIdCard:  any;
    houseName:      any;
    buildingName:   string;
    pictures:       ClotheslistPicture[];
}>


export interface Picture {
    id: number;
    playId: number;
    picture: string;
}




export interface ClothesAddParams {
    elderlyId: number;
    elderlyName:string;
    title:     string;
    content:   string;
    type:      string;
    state:     string;
    pictures:  ClothesAddPicture[];
}

export interface ClothesAddPicture {
    file: string;
}



type ClthoesAddResType = ResponseType<{
    id:             number;
    companyId:      number;
    elderlyId:      number;
    title:          string;
    content:        string;
    type:           string;
    state:          string;
    addTime:        string;
    addAccountId:   number;
    addAccountName: any;
    begName:        any;
    elderlyName:    any;
    elderlyPhoto:   any;
    elderlyGender:  any;
    elderlyIdCard:  any;
    houseName:      any;
    buildingName:   any;
    pictures:       ClotheslistPicture[];
}>
export interface ElderlyplayAdd {
    id: number;
    playId: number;
    elderlyId: number;
    elderlyName: any;
    elderlyPhoto: any;
    begName: any;
    houseName: any;
    buildingName: any;
}

export interface PictureplayAdd {
    id: number;
    playId: number;
    picture: string;
}
export interface ClothesUpdatePicture {
    file: string;
}
export interface ClothesUpdateParams {
    id:        number;
    elderlyId: number;
    title:     string;
    content:   string;
    type:      string;
    state:     string;
    pictures:  ClothesUpdatePicture[];
}
type ClothesUpdateResType = ResponseType<{
    id:             number;
    companyId:      number;
    elderlyId:      number;
    title:          string;
    content:        string;
    type:           string;
    state:          string;
    addTime:        string;
    addAccountId:   number;
    addAccountName: any;
    begName:        any;
    elderlyName:    any;
    elderlyPhoto:   any;
    elderlyGender:  any;
    elderlyIdCard:  any;
    houseName:      any;
    buildingName:   any;
    pictures:       ClotheslistPicture[];
}>
export function clotheslistAPI(params: clotheslistParams): Promise<ClotheslistResType> {
    return r.get(API.list, params);
}
export function clothesgetAPI(id: number): Promise<clothesgetResType> {
    return r.get(API.clothesget + id);
}
export function DelclothesAPI(id: number): Promise<ResponseType<null>> {
    return r.delete(API.del + id);
}
export function ClothesAddAPI(params: ClothesAddParams): Promise<ClthoesAddResType> {
    return r.post(API.add, params);
}

export function DelAllClothesAPI(id: number[]): Promise<ResponseType<null>> {
    return r.post(API.delAll, id);
}

export function FoodsUpdateAPI(params: ClothesUpdateParams): Promise<ClothesUpdateResType> {
    return r.put(API.update, params);
}

